package com.jinshan.gaietymall.utils;

/**
 * ProjectName:    gaietymall
 * Package:        com.jinshan.gaietymall.utils
 * ClassName:      BaseResponseResult
 * Author:     liujinshan
 * Description:
 * Date:    2020/4/15 8:34
 * Version:    1.0
 */
public class BaseResponseResult<T> {

    /**
     * 返回数据对象
     */
    private T data;
    /**
     * 返回结果信息
     */
    private String errMsg;
    /**
     * 返回结果编码
     */
    private String errCode;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    /**
     * @Author liujinshan
     * @Version  1.0
     * @Description 带数据的成功过返回
     * @param data:
     * @Return com.jinshan.gaietymall.utils.BaseResponseResult
     * @Date 2020/4/15 9:25
     */
    public static BaseResponseResult ok(Object data) {
        BaseResponseResult baseResponseResult = new BaseResponseResult();
        baseResponseResult.setData(data);
        baseResponseResult.setErrCode("200");
        baseResponseResult.setErrMsg("执行成功");
        return baseResponseResult;
    }

    /**
     * @Author liujinshan
     * @Version  1.0
     * @Description 不带数据的成功返回
     * @param :
     * @Return com.jinshan.gaietymall.utils.BaseResponseResult
     * @Date 2020/4/15 9:26
     */
    public static BaseResponseResult ok() {
        BaseResponseResult baseResponseResult = new BaseResponseResult();
        baseResponseResult.setErrCode("200");
        baseResponseResult.setErrMsg("执行成功");
        return baseResponseResult;
    }

    public BaseResponseResult() {
    }

    public BaseResponseResult(String errMsg, String errCode) {
        this.errMsg = errMsg;
        this.errCode = errCode;
    }

    public BaseResponseResult(T data, String errMsg, String errCode) {
        this.data = data;
        this.errMsg = errMsg;
        this.errCode = errCode;
    }
}
